//
//  SISSDraftsViewController.m
//  SISSAPP
//
//  Created by 优房网 on 2017/9/8.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSDraftsViewController.h"

@interface SISSDraftsViewController ()

@end

@implementation SISSDraftsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self requestDraftsData];
}

#pragma mark - UITableViewDelegate & UITableViewDataSource

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    SISSDrafsCell *cell = [tableView dequeueReusableCellWithIdentifier:draftsCellReuseID forIndexPath:indexPath];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    

}


/// 左滑需实现此方法
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    [self deleteDraftDataWithIndexPath:indexPath];
    NSLog(@"删除草稿");
}

///  修改delete按钮文字为“删除”
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
    return @"删除";
}


#pragma mark - 加载数据
- (void)requestDraftsData {

}

- (void)deleteDraftDataWithIndexPath:(NSIndexPath *)indexPath {
    
}

#pragma mark - UI
- (void)setupSubviews {
    [super setupSubviews];
    
    SISSBaseTableView *tableView = [[SISSBaseTableView alloc] init];
    tableView.dataSource = self;
    tableView.delegate = self;
    tableView.estimatedRowHeight = 66;
    tableView.rowHeight = UITableViewAutomaticDimension;
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [tableView registerClass:[SISSDrafsCell class] forCellReuseIdentifier:draftsCellReuseID];
    [self.view addSubview:tableView];
    self.tableView = tableView;
    
    
}


#pragma mark - 约束
- (void)initConstraint {
    [super initConstraint];
    
    WeakSelf
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(weakSelf.view);
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
